package org.web.ssm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.web.ssm.dto.ResultModel;
import org.web.ssm.service.wechatService.IWechatService;

import javax.servlet.http.HttpSession;

/**
 * Created by LUOLIANG on 2016/5/26.
 */
@Controller
@RequestMapping("/index")
public class IndexController {

    @RequestMapping("/web/{url}")
    public String webdirector(@PathVariable("url") String url) {

        return url;
    }

    @RequestMapping("/wechat/{url}")
    public String wechatdirector(@PathVariable("url") String url) {

        return "wechat/" + url;
    }

    @RequestMapping("/weopen/{url}")
    public String wechatopen(@PathVariable("url") String url) {

        return "wechat/" + url;
    }

    @RequestMapping("/home")
    public String goHome(HttpSession httpSession) {
        String URL = "manager/main.jsp";
        httpSession.setAttribute("URL", URL);
        return "success";
    }

    @RequestMapping("/manager/managerdirector")
    public @ResponseBody ResultModel<String> managerdirector(HttpSession session, String URL) {
        session.setAttribute("URL", URL);
        ResultModel<String> resultModel = new ResultModel<>();
        return resultModel;
    }


}
